'use strict';
exports.main = async (event, context) => {
    //event为客户端上传的参数
    console.log('event : ', event)
    var db = uniCloud.database();
    //2.接收前端传过来的用户名和密码与数据库里面的用户名和密码对比  查询数据表 login 用户名 密码

    var id = await db.collection('login').add({
        username: event.username,
        password: event.password,
        name: event.name,
        stuNo: event.stuNo,
        stuClass: event.stuClass
    })
    
    if (id) {
        return {
            code: 200,
            msg: "成功"
        }
    }else {
        return {
            code: 500,
            msg: "失败"
        }
    }
    console.log(result)
    //返回数据给客户端
    return event
};
